package com.wcx.imitationwechatbilllist;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;

/**
 * @author: 魏从响
 * @date: 2025/9/30
 */
public class ItemBillAdapter extends BaseQuickAdapter<ItemBean, BaseViewHolder> {
    private final Context mContext;

    public ItemBillAdapter(Context mContext, int itemItemBill, List<ItemBean> list) {
        super(itemItemBill, list);
        this.mContext = mContext;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, ItemBean item) {
            holder.setText(R.id.tv_date, item.getDate());
            holder.setText(R.id.tv_description, item.getDescription());
            holder.setText(R.id.tv_amount, item.getAmount());
            holder.setTextColor(R.id.tv_amount, ContextCompat.getColor(mContext, item.isIncome() ? R.color.green : R.color.red));
    }
}
